import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import { viteMockServe } from 'vite-plugin-mock'

export default defineConfig({
  plugins: [
    vue(),
    viteMockServe({
      mockPath: 'mock',
      localEnabled: true,
      logger: true,
      cors: true,
      ignore: /^\_/,
      watchFiles: true
    })
  ],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src')
    }
  },
  server: {
    port: 3000,
    open: true,
    cors: true,
    force: true,
    hmr: {
      overlay: false
    }
  },
  optimizeDeps: {
    include: ['@amap/amap-jsapi-loader'] // 预构建高德地图依赖
}
})